package com.ls.blog.producer;

import com.ls.blog.dto.EmailDTO;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 邮件发送
 */
@Component
public class EmailProducer {

    @Autowired
    RabbitTemplate rabbitTemplate;

    /**
     * 发送邮件
     * @param emailDTO
     */
    public void sendMail(EmailDTO emailDTO){
        rabbitTemplate.convertAndSend("emailQueue",emailDTO);
    }
}
